so you're looking for a simple transformation from one co-ord system to another ... it'll be in any vector math book (or wiki). Your local co-ord system is defined by three nodes.
The complexity for you is warped elements (when the four points do not fall on a plane). The "best" way to solve this is ...
1) don't allow warped elements, or
2) use a best fit solution (you'll have four equations defining the plane, ie redundant equations, and the solution is well known).
another day in paradise, or is paradise one day closer ?