In general, this is not possible. You want to define homography (perspective transformation) between the plane in which the original square lies and the image plane, using knowledge of the three correspondences between the points, but you need four correspondences between the points to uniquely determine the plane homography.
An example of ambiguity: suppose that the original square has its vertices at the points with uniform coordinates [0, 0, 1], [1, 0, 1], [1, 1, 1] and [0, 1, 1]. Now consider two homologies defined by the following matrices:
H1 = [1, -2, 0; 0, -1, 0; 0, -2, 1] H2 = [-1, 2, 0; 0, 1, 0; -2, 2, 1]
Both transformations leave the first three vertices invariant (remember that two points in a projective space are equal if and only if their vectors differ by a nonzero scale factor), but they transform the fourth vertex to different points.
source share