Calculating points on a plane In the example picture below, I know the points $A$, $B$, $C$ & $D$. How would I go about calculating $x$, $y$, $z$ & $w$ and $O$, but as points on the actual plane itself (e.g. treating $D$ as $(0, 0)$, $A$ as $(0, 1)$, $C$ as $(1, 0)$ and $B$ as $(1, 1)$.

Ultimately I need to be able to calculate any arbitrary point on the plane so I'm unsure as to whether this would be possible through linear interpolation of the results above or whether I would actually just have to do this via some form of Matrix calculation? I don't really know matrix math at all!
Just looking for something I can implement in JavaScript (in an enviroment that does support matricies).

This should be done in terms of plane projective geometry. This means you have to introduce homogeneous coordinates. The given points $A=(a_1,a_2)$, $\ldots$, and $D=(d_1,d_2)$ have "old"  homogeneous coordinates $(a_1,a_2, 1)$, $\ldots$, and $(d_1,d_2,1)$ and should get "new" homogeneous coordinates $\alpha(0,1,1)$, $\beta(1,1,1)$, $\gamma(1,0,1)$, and $\delta(0,0,1)$. There is a certain $(3\times 3)$-matrix $P:=[p_{ik}]$ (determined up to an overall factor) that transforms the old coordinates into the new ones. To find this matrix you have twelve linear equations in thirteen variables which is just right for our purpose. (The values of $\alpha$, $\ldots$, $\delta$ are not needed in the sequel.)
After the matrix $P$ has been determined the new affine coordinates $(\bar x, \bar y)$ of any point $(x,y)$ in the drawing plane are obtained by applying $P$ to the column vector $(x,y,1)$. This results in a triple $(x',y',z')$, whereupon one has
$$\bar x={x'\over z'}\ ,\quad \bar y={y'\over z'}\ .$$
