The gluing does not necessarily exist, neither it is unique when exists, in such generality as stated. (I am not even speaking of what the "boundary" of a Riemann surface could mean in general).
Even orin the simplest case when two original surfaces are disks, the glueing does not have to exist for an arbitrary homeomorphism.
In addition to the articles of Hamilton suggested in the previous message, I recommend the web site of Christopher Bishop, and old papers by Alfred Huber (in German).