Long subject, so I am hoping that explains what I am asking, but still let me elaborate with an example.
Let us assume we have an object as part of a container. Now the container is rotated by certain ROTATIONX, ROTATIONY, ROTATIONZ wrt the universe. Now we need to rotate the object WRT the container by rotationx, rotationy, rotationz such that the rotation of the object WRT the universe (rotx, roty, rotz) is zero. How do we do that?
Depending upon how you express rotations, you can just undo them in reverse order. Rotations do not commute. So if you did ROTATIONX, then ROTATIONY, then ROTATIONZ, you can do rotz=-ROTATIONZ, then roty=-ROTATIONY, and finally rotx=-ROTATIONX.