The hole in the transom is almost identical in size and bolt pattern, other than the 2 bottom studs that are slightly wider apart on the Yammy to enable a slightly wider cut out for the exhaust.
Although the swapping of a Yamaha drive and transom assembly for the Merc items is pretty straight forward, mating it to the motor will require some Yanmar parts, such as flywheel cover and drive plate. Both of which are pretty pricy items.
Probably cheaper and easier to do a complete transplant.
It is better to remain silent and be thought a fool, than to speak and remove all doubt!