Let's talk about linear geometric transformations in homogeneous coordinates. In your question there are mainly two kind of geometric transformations involved: planar rotation and planar scaling, the computation-friendly analytical re-definitions of which are found hereUnified frameworks of elementary geometric transformations.
The 2D homogenous rotation matrix that rotates 2D objects clockwise by $\theta$ radians is as below:
$$R=\left[
\begin{array}{ccc}
\cos \theta & \sin \theta& 0 \\
-\sin\theta & \cos\theta & 0 \\
0 & 0 & 1 \\
\end{array}
\right]$$
A 2D scaling due to unequal aspect ratio $\rho$ in this case is a stereohomology with $x$ axis $(0,1,0)^T$ as the stereohomology interface (a line of invariant points), and the normal direction $(0,1,0)^T$ as its stereohomology center per definition 3.9 in page 12 and line No. 5 in Table 1, page 9 of the article Unified frameworks of elementary geometric transformations. Then its scaling matrix can be obtained as below:
$$S=\color{gray}{\left[
\begin{array}{ccc}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right]+\left(\rho-1\right)\dfrac{\left[
\begin{array}{c}
0 \\
1 \\
0 \\
\end{array}
\right]\cdot \left[
\begin{array}{ccc}
0 & 1 & 0 \\
\end{array}
\right]}{\left[
\begin{array}{ccc}
0 & 1 & 0 \\
\end{array}
\right]\cdot \left[
\begin{array}{c}
0 \\
1 \\
0 \\
\end{array}
\right]}=}\left[
\begin{array}{ccc}
1 & 0 & 0 \\
0 & \rho & 0 \\
0 & 0 & 1 \\
\end{array}
\right]$$
When aspect ratio normally is $\rho=1$, suppose under this circumstance the original object has the homogeneous coordinates of $n$ points in $3\times n$ matrix $X$, and the transformed object in $3\times n$ matrix $Y$, then the geometric transformation between them is the rotation you have mentioned:
$$Y=R\cdot X$$
When the aspect ratio abnormally is $\rho\ne 1$, both $X$ and the $Y$ after rotation are as a matter of fact scaled along the $y$ axis:
$$X'=S\cdot X$$
$$Y'=S\cdot Y$$
Now you want to find the geometric transformation $T$ which satisfies $Y'=T\cdot X'$. Since:
$$Y'=S\cdot Y=S\cdot R\cdot X =S\cdot R\cdot S^{-1}\cdot X'$$
then
$$T=S\cdot R\cdot S^{-1}$$
$$=\color{gray}{\left[
\begin{array}{ccc}
1 & 0 & 0 \\
0 & \rho & 0 \\
0 & 0 & 1 \\
\end{array}
\right]
\cdot
\left[
\begin{array}{ccc}
\cos \theta & \sin \theta& 0 \\
-\sin\theta & \cos\theta & 0 \\
0 & 0 & 1 \\
\end{array}
\right]\cdot
\left[
\begin{array}{ccc}
1 & 0 & 0 \\
0 & \dfrac{1}\rho & 0 \\
0 & 0 & 1 \\
\end{array}
\right]=}\left[
\begin{array}{ccc}
\cos \theta & \dfrac{\sin \theta}{\rho } & 0 \\
-\rho \sin\theta & \cos \theta& 0 \\
0 & 0 & 1 \\
\end{array}
\right]$$
It is a rotation under the generalized meaning.