How to transform location and rotation parts individually? Short Question:
If $T_\mathrm{loc}$, $P_\mathrm{rest}$ and $P_\mathrm{loc}$ are translation matrix and $T_\mathrm{rot}$ and $P_\mathrm{rot}$ are rotation matrix, how can I obtain values of $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ such that
$T_\mathrm{loc} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot} = P_\mathrm{rest} \cdot Q_\mathrm{loc} \cdot Q_\mathrm{rot}$
where, $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ must be translation matrix and rotation matrix respectively.
Detailed Explanation:
I'm working on a (Computer Graphics) project where I want to multiply a transformation matrix $T$ (more precisely, $T = T_\mathrm{loc} \cdot T_\mathrm{rot}$, ie. it first rotates about world axis and then translates given point). 
I already have $T$ and if I apply $T$ to a point $P_w$ I get appropriate $P_w'$.
However, my problem is I don't directly have $P_w$. I compute it as $P_w = P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$. Also I want to get the result back in the same form $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ (ie. in 2 parts, a translation matrix and a rotation matrix).
I have tried 
$Q_\mathrm{loc} = T_\mathrm{loc} \cdot P_\mathrm{loc}$  ...(since translations are commutative)
$Q_\mathrm{rot} = P_\mathrm{rest}^{-1} \cdot P_\mathrm{loc}^{-1} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$  
which mathematically should result in
$RHS = P_\mathrm{rest} \cdot Q_\mathrm{loc} \cdot Q_\mathrm{rot}$
$    = P_\mathrm{rest} \cdot T_\mathrm{loc} \cdot P_\mathrm{loc} \cdot P_\mathrm{rest}^{-1} \cdot P_\mathrm{loc}^{-1} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$
$    = T_\mathrm{loc} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$  ...(since translations are commutative)
$    = LHS$  
However, I'm now convinced that the above will not work since $Q_\mathrm{rot}$ is a rotation matrix (ie. only rotation part) and hence there's no effect of  $P_\mathrm{rest}^{-1}$ and $P_\mathrm{loc}^{-1}$.
I know this must be possible somehow since we can represent any point in 3D space with a rotation and a translation, but I'm lost. Any help would be greatly appreciated.
Thanks in advance.
 A: Although I haven't completely understood your context (what all these matrices are for), the problem is easier when not thinking strictly in general matrix algebra, but using the special property of those matrices (they're all rigid-body transformations). First compute your left hand side, then left-divide by $P_{rest}$:
$P_{rest}^{-1} \cdot T_{loc} \cdot T_{rot} \cdot P_{rest} \cdot P_{loc} \cdot P_{rot} = Q_{loc} \cdot Q_{rot}$
The resulting matrix should be the product of $Q_{loc}$ and $Q_{rot}$. A product of rigid body matrices (which only contain translation and rotation, as in your case) is always a rigid-body matrix itself. So you can just decompose the resulting $Q_{loc} \cdot Q_{rot}$ into a rotation with successive translation, by just taking the rotation part ($Q_{rot}$) from the upper-left 3x3 part of the matrix (setting the last column and row to identity) and the translation part ($Q_{loc}$) from the last column (setting the upper-left 3x3 part to identity).
You will see, just copying the last column of $Q_{loc}$ into $Q_{rot}$ is equal to $Q_{loc} \cdot Q_{rot}$ if the former is a translation-only matrix and the latter a rotation-only matrix. But of course it wouldn't work that easy if the multiplication order was reversed.
