set To Quad To Unit Square Homography
Set this matrix to the ground-to-image homography that maps four arbitrary corners ((0,0), (p1x,p1y), (p2x,p2y), (p3x,p3y), in counter-clockwise order: bottom-left, bottom-right, top-right, top-left) to the unit square (0,0), (1,0), (1,1), (0,1).
Approach: build the image-to-ground square-to-quad homography Hi via Heckbert's closed-form (Fundamentals of Texture Mapping and Image Warping), then invert 3x3 to get the direction the fragment shader needs. The corners are passed relative to the bottom-left (so it's treated as the origin), which drops the third column of Hi to (0, 0, 1) and roughly halves the cofactor terms.
Inputs are 2D coordinates in any consistent linear frame (e.g. lon/lat in degrees, or local-tangent meters); for sub-km footprints the planar approximation is well under a metre even on a curved Earth.
Parameters
x of bottom-right relative to bottom-left
y of bottom-right relative to bottom-left
x of top-right relative to bottom-left
y of top-right relative to bottom-left
x of top-left relative to bottom-left
y of top-left relative to bottom-left