Ok this ones kind of manageable* if the number of vertices's match and theres some other clues on how to map the vertices, such as in this case orientation i guess. So pseudocode would look like this:
from reference face get uvs
(from reference face get orientation)
(renumber additional faces uv vertices based on orientation)
from additional faces set uvs to match reference face
Some additional thoughts. Does it need to be able to handle faces with different number of edges? I mean the heuristic of orientation could be possibly be based on shape conformance too in which case even a non similar face could work out, this could be useful if the face has holes in it. Tough thats significantly harder to do. But it is remotely possible.
Straightening:
Well strightening is easy, however where do you want the edge to be? And what orientation? Horizontal vertical? least squares fitting? Initial sample fitting? Average fitting? Area average fitting? area least squares fitting? Locked to some point?
*manageable as in yes it can be done but it requires the user to actually understand that the info he gave has some things the programmer need to guess on. Guesses always at some point blow in your face when the user next in line is no longer aware of the real inner workings of the tool.
PS: you should not give people gui items to show your functionality. Its not very smart. If i can solve this without a gui button use it. You should also want systems that need no input if possible. You dont want more buttons you just want things to work sometimes buttons are the thing but sometimes not. You dont start design by saying button for X, you start by saying solution for problem X. You dont specify that the solution has to use a computer etc etc.
You just say the most abstract thing that you can. This way you dont collude the design process with wrong assumptions and thus constrain the thinking of yourself and others. Your looking for a good solution, and blocking avenues of research is NOT a the way to do it. It can significantly slow down your design time as well as give sub par solutions. Your not closer to any usable solution by showing its going to go in this gui. You should evcen go deeper than just saying this needs doen and reason why you get there in the firstplace.