Given two connected trapezoidal prisms are connected as follows:

I can apply a rotation to the prism on the left by rotating about the local X-Axis (top of the prism) - As they are connected the prism on the right will be affected:
My question is: If I do not refer to the first prism, how would I calculate the applied transforms to the second prism in isolation?
I know: a) The rotation angle about the X-Axis applied to the first prism b) The local rotation about the Z-axis of the second prism to make the two prisms join
I would like to calculate the rotation about X & Y axis on the second prism.
