The solution will not be unique, as pointed out by Alex319.
If the second image is really a trapezoid, as you say, it will not be too difficult. This is a trapezoid (not a parallelogram) because of the perspective, so it should be an isosceles trapezoid.
Draw two diagonals. They intersect in the center of the rectangle, so it takes care of the translation.
Rotate the trapezoid until its parallel sides are parallel to the two sides of the original rectangle. (Which two? It doesn't matter.)
Draw a third parallel through the center. Scale this on the sides of the rectangle that you selected.
Now for rotation from the plane. Measure the distance from the center to one of the parallel sides and use the law of sines.
If this is not a trapezoid, but only a quadrature, then it will be more difficult, you will need to use the angles between the diagonals to find the axis of rotation.
Beta
source share