Normally you do it in an external program (for eg in Blender) at modeling time.
For a plane, as there’s a very little number of vertices, you can do it programmatically by building the uvs yourself and setting them by calling mesh.setVerticesData("uv", uvarray).
I think you can also use faceuv at plane creation time (see Product Customizer - UI and applying/projecting elements (text, image) to the specific part of the UV space for a use case with a cube).