I'm trying to create a program that will straighten a trapezium into a square (as you do). The program is supposed to use it's knowledge of the shape of the trapezium to then apply a transformation to the cornerPins to straighten the shape out. I can roughly do it by mouse manually but this is unacceptable as a final result due to many issues: mainly accuracy and speed. These images should help demonstrate what I'm trying to do.
*
*First image is original shape before the warp, in the second image the green trapezium has become a square from the warp.**
Ultimately I'm looking for either a formula or function that will allow me to find how much to raise/lower the cornerpins to straighten the square.