Given some quadrilateral $Q \subset \mathbb R^2$ defined by the vertices $P_i = (x_i,y_i), i=1,2,3,4$ (you can assume they are in positive orientation), is there a function $f: \mathbb R^2 \to \mathbb R^2$ that is particularly easy to compute which satisfies
$$f(Q) \subseteq U \quad \text{ and } \quad f(\mathbb R^2 \setminus Q) \subseteq \mathbb R^2 \setminus U?$$
Here $U = [0,1]\times[0,1]$ denotes the unit square (or $U=[-1,1]\times[-1,1]$ if you prefer)
My first attempt was using a function $f(x,y) := (a + bx + cy +dxy, a' + b'x+c'y +d'xy)$ (known as the 2d perspecitve transformation bilinear interpolation), but determining the coefficients $a,b,c,\ldots, d'$ requires inveriting $4\times 4$ matrix to solve two linear systems of equations.
EDIT: The actual 2d perspective transformation as described here does only produce the desired result if $Q$ is convex, which is not necessarily the case.
