If you begin with a horizontal object whose initial dimensions are $L_x$ and $L_y$ (before scaling), then the offset between blue and red text should be
$$
\begin{align}
&\Delta x={K_x-1\over2}L_x(1-\cos\alpha)+{K_y-1\over2}L_y\sin\alpha,\cr
&\Delta y=-{K_y-1\over2}L_y(1-\cos\alpha)+{K_x-1\over2}L_x\sin\alpha,\cr
\end{align}
$$
where $\alpha$ is the rotation angle with respect to the horizontal and $K_x$, $K_y$ are the scaling factors.
The sign of $\Delta x$ and $\Delta y$ depends on how you measure $\alpha$, so you may need to find the correct sign by trial and error. Hope that helps.
EDIT
To show how those formulas can be derived, consider the black rectangle in the diagram below. Scaling it (with respect to up-left vertex $P$) and then rotating around the center $O'$ of the scaled rectangle yields a final brown rectangle, whose up-left vertex is $P'$.
If the black rectangle is first rotated around its center $O$ and then scaled with respect to $P''$, then we get instead the blue rectangle below. We are interested in finding the "offset" vector $\vec{P'P''}$.
If we denote by $R$ the rotation operator
($R(x,y)=(\cos\alpha x-\sin\alpha y, \cos\alpha y+\sin\alpha x)$, if positive angles represent a counterclockwise rotation) and by $S$ the scaling operator
($S(x,y)=(K_x x,K_y y)$), then we have:
$$
\vec{P'P''}=\vec{P'O'}+\vec{O'O}+\vec{OP''}=
R\vec{PO'}+(S-1)\vec{OP}+R\vec{OP}=
-R(S\vec{OP})+(S-1)\vec{OP}+R\vec{OP},
$$
that is:
$$
\vec{P'P''}=
(S-1)\vec{OP}-R(S-1)\vec{OP}.
$$
Inserting here $\vec{OP}=(-L_x/2,L_y/2)$ one gets the desired result.
In comparing with my old formulas above, I see that
$\vec{P'P''}=(-\Delta x,-\Delta y)$.
In addition, I used there the opposite convention for the sign of the angle, but I hope this explanation is clear enough.
Best Answer
1) Translate everything to bring $F$ to the origin (i.e. subtract $\vec {OF}$):
the points become $A',B', \cdots$
2) Translate the object bringing $D' \to F'=O$:
points are $A'', B'', \cdots$
3) Now you have three point $E'', G''$ and the $O=F'$. They define a plane in which they lie.
4)In that plane you have to make a dilation (length $|OE''| = |OG''|$) and a rotation to finally bring $E''$ to $G''$
5) revert the first translation