Projecting Coordinates from one Space into another, but with “twisting”


i’m trying to generate a decal mesh kinda like this: http://blog.wolfire.com/2009/06/how-to-project-decals/

but instead of projecting the decal with a box, i need to project it with a sort of triangular space. the “decal space” will have a start triangle and an end triangle. the end triangle isn’t necessarily the same size as the start triangle and it isn’t necessarily parallel to it and it can be rotated.

i need to be able to transform coordinates into that space and back out. how can i do that? can you do that with a normal 4×4 matrix?