How to apply Transformations on FragCoord?

So I have this fragment Shader these two images:

The image on the left and right has scaling applied to it from my main development code (I’ll share relevant code at the bottom) the image on the left is what occurs when I apply the FragCoord (or what comes out after using the distortion function) onto the texture and the image on the right is what occurs when I apply the texture with the TexCoord

As you can see with the picture on the right the texture is actually being scaled while the one on the left, it doesn’t seem like the texture is being affected by the scaling? Below is my fragment shader, the goal of what im doing here is to add distortion/scaling/translation/rotation to the RGB of the texture that is displayed.
Fragment Shader

#version 330 core
out vec4 FragColor;
out vec4 FragColor1;
out vec4 FragColor2;

in vec3 ourColor;
in vec2 TexCoord;
layout(origin_upper_left) in vec4 gl_FragCoord;

out vec2 texCoord;

// texture samplers
uniform sampler2D texture0;
  
uniform vec4 objectColor;
uniform vec2 resolution;
uniform vec2 Positions;

vec3 distort()
{
vec2 p = gl_FragCoord.xy / resolution.x;//normalized coords with some cheat
                                                         //(assume 1:1 prop)
float prop = resolution.x / resolution.y;//screen proroption
vec2 m = vec2(0.5, 0.5 / prop);//center coords
vec2 d = p - m;//vector from center to current fragment
float r = sqrt(dot(d, d)); // distance of pixel from center

float power = ( 2.0 * 3.141592 / (2.0 * sqrt(dot(m, m))) ) *
			(Positions.x / resolution.x - 0.5);//amount of effect

float bind;//radius of 1:1 effect
if (power > 0.0) bind = sqrt(dot(m, m));//stick to corners
else {if (prop < 1.0) bind = m.x; else bind = m.y;}//stick to borders

//Weird formulas
vec2 uv;
if (power > 0.0)//fisheye
	uv = m + normalize(d) * tan(r * power) * bind / tan( bind * power);
else if (power < 0.0)//antifisheye
	uv = m + normalize(d) * atan(r * -power * 10.0) * bind / atan(-power * bind * 10.0);
else uv = p;//no effect for power = 1.0

vec3 col = texture(texture0, vec2(uv.x, -uv.y * prop)).xyz;//Second part of cheat
                                                  //for round effect, not elliptical
return col; 
}

void main()
{
vec4 TexColour = texture(texture0, TexCoord);
vec4 Finalcolor = (vec4(distort(),1.0)) * objectColor;
FragColor = Finalcolor;
}

The problem is that the only way I’ve gotten the distortion to work is by using FragCoord (using TexCoord in its place doesn’t produce any results) but the scaling/translation/rotation doesn’t really work unless TexCoord is applied to the incoming texture. I’ve been looking up alot of different methods of doing what I want to achieve but I haven’t found anything that works and honestly I’m a bit lost in even trying to ask this question. So please ask any clarifying questions since this is just a struggle to wrap my head around. I will also include the Vertex Shader and my window loop that I am performing.

Vertex Shader

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 2) in vec2 aTexCoord;

out vec2 TexCoord;

uniform mat4 transform;

void main()
{
	gl_Position = transform * vec4(aPos, 1.0);
	TexCoord.xy = aTexCoord.xy;
}

Window Loop

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //settings background color
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT);
    glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);

    // bind textures on corresponding texture units
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textures[0]);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, textures[1]);
    // create transformations
    glm::mat4 transform = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first
    transform = glm::translate(transform, glm::vec3(values[11], values[12], 1.0f));
    transform = glm::rotate(transform, values[2], glm::vec3(0.0f, 0.0f, 1.0f)); //rotation_angle can go here in place of value[..]
    transform = glm::scale(transform, glm::vec3(values[5], values[6], 0));

    // get matrix's uniform location and set matrix
    ourShader->use();
    ourShader->setVec4("objectColor", values[30] / 255.0f, values[31] / 255.0f, values[32] / 255.0f, values[33]);
    ourShader->setFloat("timeSec", time_spent);
    ourShader->setFloat("radius", values[34]);
    ourShader->setFloat("strength", values[35]);
    ourShader->setVec2("resolution", values[0], values[1]);
    ourShader->setVec2("Positions", values[36], values[37]);
    unsigned int transformLoc = glGetUniformLocation(ourShader->ID, "transform");
    glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));

    // render container
    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);

The values array is a set of parameters that are read in through a text file, most relevant ones to know is that values[0] and [1] is the resolution of 1024x1024. Positions values[36] is 512 and these are mostly used in the distortion function. and then scaling is the rgb of x and y of the texture so values[5] is 1.0 in the two pictures that I shared. Let me know if I need to provide any more information, Thanks!