I would like to find the coordinates of a 3D point P’ on a rectangle matching the relative position of a point P on the plane formed by a quadrilateral as shown below (P isn’t necessarily inside the quad). The four points of the quad Q1, Q2, Q3 and Q4 are mapped to the four points of the rectangle R1, R2, R3 and R4 respectively.

This problem is related to perspective transformations and the solutions I’ve found so far on the web are mostly very generic or for 2D transforms which don’t handle points outside the quad (e.g. this one). I was wondering if there was a relatively simple solution to compute that point using Unity’s functions.

Here’s an approach using barycentric coordinates.
Here’s the core routines, which convert a point and triangle to a triple of barycentric coordinates, and then the reverse. You can then use this on 4 triangles in your quad (eg, one triangle per vertex) and compute the four sets of barycentric coordinates from the source quad and then average the results in the destination quad.

Thanks for sharing, I found a lot of interesting information here. A really good post, very thankful and helpful that you will write many more posts like this one.