Suppose, I have a 2D rectangle ABCD like the following:
$A(0,0)$, $B(140,0)$, $C(140,100)$, $D(0,100)$.
I want to rotate the whole rectangle by $\theta = 50°$.

I want to rotate it around the Z-axis by an arbitrary angle using a rotation transformation matrix.
How to do that?
I know that, $$ A = \begin{bmatrix} \ 0 & 0 & 1 \\ \end{bmatrix}; B = \begin{bmatrix} \ 140 & 0 & 1 \\ \end{bmatrix}; C = \begin{bmatrix} \ 140 & 100 & 1 \\ \end{bmatrix}; D = \begin{bmatrix} \ 0 & 100 & 1 \\ \end{bmatrix}. $$
And, I know that the rotation matrix is, $$R = \begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}$$
Now, what is the calculation?
I have tried the following ways,
$$Rotation = \begin{bmatrix} \ 0 & 0 & 1 \\ 140 & 0 & 1 \\ 140 & 100 & 1 \\ 0 & 100 & 1 \\ \end{bmatrix}.\begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}$$
And, $$ A' = \begin{bmatrix} \ 0 & 0 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\\ B' = \begin{bmatrix} \ 140 & 0 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\\ C' = \begin{bmatrix} \ 140 & 100 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}\\ D' = \begin{bmatrix} \ 0 & 100 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} $$
For example,
$$B' = \begin{bmatrix} \ 140 & 0 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos 50^\circ & -sin 50^\circ & 0 \\ sin 50^\circ & cos 50^\circ & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix} \ 89.99 & -107.24 & 1 \\ \end{bmatrix}\\ C' = \begin{bmatrix} \ 140 & 100 & 1 \\ \end{bmatrix} . \begin{bmatrix} \ cos 50^\circ & -sin 50^\circ & 0 \\ sin 50^\circ & cos 50^\circ & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix} \ 166.59 & -42.96 & 1 \\ \end{bmatrix}$$ What is the right way to work with?
I have solved my problem.
$$Rotation = \begin{bmatrix} \ 0 & 0 & 0 \\ 140 & 0 & 0 \\ 140 & 100 & 0 \\ 0 & 100 & 0 \\ \end{bmatrix}.\begin{bmatrix} \ cos \theta & -sin \theta & 0 \\ sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}$$
Alternatively,
$$ A' = \begin{bmatrix} \ 0 & 0 & 0 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & sin \theta & 0 \\ -sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix}0 & 0 & 0\end{bmatrix}\\ B' = \begin{bmatrix} \ 140 & 0 & 0 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & sin \theta & 0 \\ -sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix}98.9949 & 98.9949 & 0\end{bmatrix}\\ C' = \begin{bmatrix} \ 140 & 100 & 0 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & sin \theta & 0 \\ -sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix}28.2843 & 169.706 & 0\end{bmatrix}\\ D' = \begin{bmatrix} \ 0 & 100 & 0 \\ \end{bmatrix} . \begin{bmatrix} \ cos \theta & sin \theta & 0 \\ -sin \theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = \begin{bmatrix}-70.7107 & 70.7107 & 0\end{bmatrix}\\ $$