In the code v_tex is a vec2 does that mean the vertex shader is passing in a vec2 to this fragment shader? What exactly is v_tex?
Yes, this means that the fragment shader is expecting an input of the type vec2. As stated above in the answer, to accept an input from the vertex shader, we need to specify that a certain variable is expecting a value of a certain type (vec2) from the vertex shader using the in keyword.
In the vertex shader, there's a variable of type vec2 that has the out keyword and it matches the type of v_tex which is vec2.
v_tex is a vec2 which means that it can hold 2 floats.
I believe it represents the texture coordinates for the current pixel.
As for it's role in the code you've provided, as far as I can understand, center is being subtracted from v_tex and then normalized, then the result is scaled by u_amount which should represent the displacement amount.
The result of this operation is a normalized vec2 that is scaled by u_amount. It is based on the difference between the current pixel coordinates and the centre of the texture.
To actually apply this displacement effect, we need to set the colour of the current pixel.
The color = texture(u_texture, v_tex - displacement) operation samples the texture u_texture at the texture coordinates v_tex - displacement.
In simpler words, what this does is that it gets the colour of the pixel that is at the v_tex - displacement coordinate of the u_texture texture and assigns it to the colour of the current pixel (which is the pixel at the v_tex coordinates).
The final colour is then outputted.
I don't know what the exact result of this shader output looks like but I hope that I was able to at least give you an idea about what this is doing.