rotation matrix for changed body coordinate system

I need help to calculate the following

I have 2 bodies with a body coordinate coordinate system (A and B)

The matrix R describes the rotation between body A and B. (in this case calculated from an xyz euler angle sequence)

where B = R*A

Now i have defined another set of body coordinate system (A' and B'), defined as a transform from the original body coordiante system (T_a and T_b). where A' = T_a * A and B' = T_b * B

I am looking for the matrix that describes the rotation R in terms of A' and B'.

What is the equation i need to use?

Re: rotation matrix for changed body coordinate system