Mapping to "unshrinkable" surface

Hello, I need to map rectangular pattern onto a curve surface. Due to surface complexity, the shrinked surface is not rectangular. So (I guess) I should first map the 2D pattern into the surface trim boundary in UV space and then map that onto the 3D surface.

What would be the best way to approach that?
Thanks in advance.

Can you please share the pattern you are mapping and an example file that has the surface? A sketch of the intended result will help too.