Without going into too many details - I get the parameters (x1, x2, y1, y2, a, b, Ξ±) from the web tool, and I need to create a PDF document using the Zend_PDF library, which contains the green image rotated and correctly positioned on the exact coordinates.

What confuses me now is that Zend doesn't allow you to rotate elements, but instead rotates the paper. So, I assume that rotation should be done as follows
$page->rotate($x1 + ($x2 - $x1) / 2, $y1 + ($y2 - $y1) / 2, - deg2rad($rotation));
because we want the center of the image to be a pivot, and we rotate it in the opposite direction so that the resulting image gets the correct rotation.
The hard part that I'm having problems with is drawing it. With a simple call
$page->drawImage($image, $x1, $y1, $x2, $y2);
I get the result as shown in the diagram - the resulting image also needs to be translated, since (x1, y1) and (x2, y2) are no longer the exact coordinates, but I'm not sure how to calculate them? Any ideas?