I'm trying to implement a general shearing transform in the Unity game engine. Since Unity transforms are limited to TRS (translate, rotate, scale) the best way I found to do this is to simply chain together 2 rotation-scale transformations to achieve a net shearing. As far as I can tell this can be done generally, but I've been struggling to work out the math.
More formally I want to find any set of $s^x_1, s^y_1, s^x_2, s^y_2, \theta_1, \theta_2$ for a given $c_x$ and $c_y$ that solves the following equation:
$$ \begin{pmatrix} 1 && c_x \\ c_y && 1 \end{pmatrix} = \begin{pmatrix} s^x_1\cdot\cos(\theta_1) && -s^y_1\cdot\sin(\theta_1) \\ s^x_1\cdot\sin(\theta_1) && s^y_1\cdot\cos(\theta_1) \end{pmatrix} \cdot \begin{pmatrix} s^x_2\cdot\cos(\theta_2) && -s^y_2\cdot\sin(\theta_2) \\ s^x_2\cdot\sin(\theta_2) && s^y_2\cdot\cos(\theta_2) \end{pmatrix} $$
My goal is here is to write code that makes this calculation automatically. A numerical solution would also be fine for my use case.