I tried a similar approach in my doodles: take 3 vertices which constitute a face of the mesh and create a plane from these. It works with simple meshes, more complex tessellation can potentially result in the plane being aligned with a diagonal edge:
ensures that the plane is always defined with the current pt (origin), x pt (next1) and y pt (prev1). If the shift value is 0 then the vertex N 0 (per face) is taken. So for a quad Face it’s out of question taking a diagonal end as the y pt.
If on the other hand you are after “aligning” vertices on a per mesh face basis a proper recursive approach can cut the mustard (start from face 0 and check all the neighbors : if vertices are not in the order that you want, reorder vertices create a new face > delete the old and insert the new - or rather better : just reorder the neighbor vertices [required for the from plane] accordingly). Obviously this requires some solid rule (not always possible for any situation).
I was trying to find a generalized solution, which would work for all meshes regardless whether they are comprised of tri or quad faces. That’s the main reason why I decided to take the mesh outline rather than individual faces. This way the texture will be aligned to at least one outside edge of the mesh.
BTW: Some meshes are OK for what you want (see attached that allows you to inspect the order on a per face basis). For the rest you need some lines of code [recursion]: try to do it as an entry level challenge (on Face/Face and Face/Vertex connectivity matters).
Thanks @PeterFotiadis, I appreciate your contribution. For my particular application it makes more sense to use a mesh outline but hopefully other people will be able to benefit from your code in the future.