Text this: Optimisation-based characterisation of multimodal waveguide transitions