I have a matrix which performs a 2D rotation around any given center. Using homogenous coordinates, I have the matrices:
$$ T = \begin{pmatrix} 1 & 0 & C_x \\ 0 & 1 & C_y \\ 0 & 0 & 1 \end{pmatrix}$$
where $C_x$ and $C_y$ are the coordinates of the rotation center, and
$$ R = \begin{pmatrix} \cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \end{pmatrix}$$
Now I can obtain the matrix $X = TRT^{-1}$, which translates everything to the origin, rotates and then translates back to the given center.
My question is, given $X$, is it possible to find $C_x$, $C_y$ and $\theta$ ?
At first blush, I'd think so, since (where $c$ and $s$ are the cossine and sine, respectively) $$ X = \begin{pmatrix} c & -s & C_x(1-c)+C_ys \\ s & c & -C_xs+C_y(1-c) \\ 0 & 0 & 1 \end{pmatrix} = \begin{pmatrix} c & -s & \beta \\ s & c & \gamma \\ 0 & 0 & 1 \end{pmatrix} $$
It then becomes a simple matter of solving for $C_x$ and $C_y$. But the result I'm finding is
$C_y = \dfrac{\beta+C_x(c-1)}{s}$
$C_x = \dfrac{C_y(c-1)-\gamma}{s}$
However, working on from here, the results I'm getting give the center as a function of the angle of rotation, which would mean that, as the rotation occurs, the center is moving, which is obviously incorrect.
So, how can this be done?
I have seen the these questions (1, 2 and 3) but they all deal with X = TRS (S = scale). My question actually seems simpler than these, but I just can't figure it out.