In TikZ writting, as in a mathematical composition of functions, say t composed with r and applied to a, which is t(r(a)), the function appearing last in the writting process is firstly applied. Here, for example, r acts firstly on a, and then t acts on the result g(a). Going back to the shift+rotation or rotation+shift, the result depends on which of the two elementary isometries appears last.
In the initial drawing of the question, as for the blue filled square in Figure 1 above, the rotation appears last. So the black square is rotated with respect to the origin and then the result is translated with the vector (2.8, 0.8).
Remark Every rotation, independently of its position in the \draw
command, is performed with respect to the center (0, 0).
In Figure 2, the two composed isometries are graphically decomposed.
The code
\documentclass[11pt, a4paper]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}
\tikzmath{%
real \dx, \dy, \da, \r, \R;
\dx = 2.8;
\dy = .8;
\da = -23;
\r = {sqrt(2)};
}
\begin{figure}[htb!]
\centering
\begin{tikzpicture}[every node/.style={inner sep=.1cm, fill opacity=1},
scale=.8]
\draw[gray!50] (-2, -2) grid (5, 3);
\draw[red, ->] (-3, 0) -- (6, 0);
\draw[red, ->] (0, -3) -- (0, 4);
\draw[very thick](-1, -1) rectangle ++(3, 3);
\filldraw[fill=blue!90!green, fill opacity=.4]
[xshift=\dx cm, yshift=\dy cm, rotate=\da]
(-1, -1) rectangle (2, 2);
\filldraw[fill=violet, fill opacity=.4]
[rotate=\da, xshift=\dx cm, yshift=\dy cm]
(-1, -1) rectangle (2, 2);
\end{tikzpicture}
\caption{The blue filled square is issued from the initial question.
It is the result a rotation of angle $-22^\circ$ with respect to
the center $(0, 0)$, and then of a translation with the vector
$(2.8, .8)$. The red filled square is the result of the
translation and then the rotation operations applied on the same
black non filled square.}
\label{fig:1}
\end{figure}
\begin{figure}[htb!]
\centering
\begin{tikzpicture}[every node/.style={inner sep=.1cm, fill opacity=1},
scale=.8]
\draw[gray!50] (-2, -2) grid (5, 3);
\draw[red, ->] (-3, 0) -- (6, 0);
\draw[red, ->] (0, -3) -- (0, 4);
\draw[very thick] (-1, -1) rectangle ++(3, 3);
\filldraw[fill=blue!90!green, fill opacity=.1][rotate=\da]
(-1, -1) rectangle ++(3, 3);
\begin{scope}[xshift=\dx cm, yshift=\dy cm]
\filldraw[fill=blue!90!green, fill opacity=.4][rotate=\da]
(-1, -1) rectangle ++(3, 3);
\end{scope}
\draw (170: \r) arc (170: 250: \r);
\end{tikzpicture}
%
\begin{tikzpicture}[every node/.style={inner sep=.1cm, fill opacity=1},
scale=.8]
\draw[gray!50] (-2, -2) grid (5, 3);
\draw[red, ->] (-3, 0) -- (6, 0);
\draw[red, ->] (0, -3) -- (0, 4);
\draw[very thick](-1, -1) rectangle ++(3, 3);
\filldraw[fill=violet, fill opacity=.1]
(-1+\dx , -1+\dy ) rectangle ++(3, 3);
\filldraw[fill=violet, fill opacity=.4][rotate=\da]
(-1+\dx , -1+\dy ) rectangle ++(3, 3);
\end{tikzpicture}
\caption{The two compositions form Figure 1 decomposed in elementary
\texttt{TikZ} drawing commands. In both cases, the center of
rotation is the origin, the point $(0, 0)$.}
\label{fig:2}
\end{figure}
\end{document}
(5pt, 5pt)
, the shifted origin. And the square that is being rotated is not the green one, but the one touching that red circle[yshift = 1cm]
(move forward 1cm),[rotate = 30]
(turn left 30 degrees),[yshift = 2cm]
(move forward 2cm), ...