Hi, does anybody know an algorithm to create any wanted polygon with triangles?

Example: I have a rectangle defined by its edges and I want to create that rectangle with triangles.

Thanks in advance!