Applying a pixelisation effect to a curved river

Hi all.
Earlier last year I was working on a shader in Unity for a water shader that would make ripples travel down a curved river model, and then have it pixelised globally.
The original shader was done as a shadergraph, but the code to apply the pixelation to the model was done through the following code, curtosy of BastianUrbach on Unity Answers in this post here Shader Graph - Is it possible to work with both UV nodes and Position nodes? - Questions & Answers - Unity Discussions

In Godot, I’ve got the shader working completely in code, and have most things working, but the main problem is this section provided by BastianUrbach here:

It has the input nodes of:
Vec3 original
Vec3 modified
Vec2 UV

with an output Vec2 Out node

float2x2 M = float2x2(ddx(Original.x), ddy(Original.x), ddx(Original.y), ddy(Original.y));
float2x2 I = float2x2(M._22, -M._12, -M._21, M._11) / determinant(M);
float2 delta = mul(I, Modified - Original);
Out = UV + ddx(UV) * delta.x + ddy(UV) * delta.y;

I’m currently struggling to convert this section into Godot’s shader language. I believe mat2 is the equivalent of float2x2 in Godot, but I could be mistaken. Any help would be greatly appreciated.