Cannot get rid of texture stretching with morphTarget

Hi there,

I am trying to create a wooden Frame that can be scaled in its width and height by the user.
My first approach was to cut the frame into corner parts, vertical parts and horizontal parts and position and scale them. That worked as intended but i could not get the right texturing in the corners to work. Here is a image of what that approach looks like:

Recently i came across morphTargets in threejs and i thought it would be a much better approach to this problem. So i created a frame in Blender with shape keys for width and height of the frame. I made four different frame parts: left, upper, right and lower. Here is the Blender file:

FrameTest.blend (999.4 KB)

With this setup i built a component that scales the frame and applies a wood texture on it:

https://codesandbox.io/p/devbox/morphtestuv-6wrln7

And it looks way better but it is still not 100% accurate, because if i increase the height and scale the texture with the parts the uv in the corners of the mesh get stretched. Here is a video to show the texture stretching:

Any hints on how to solve this issue would be great. Maybe there are some approaches i havent even thought of.

Greeting Tom