Weeeird. I wish I had a picture of your sprite without influence from the shader so I could get a better idea of how things are changing.
You clearly know this because since you knew setting the output(gl_FragColor) to what you sampled would effectively disable any shader effects, but for everyone else: texture2d() is a function that returns a pixel(the color) at a given coordinate (uv) from a supplied texture, or tex0 as it's called in RenPy.
vec4 color = texture2d(tex0,uv) in this case would be the pixel color information from the source texture/image.
Shaders would then typically operate on, or using, this information to eventually assign it to the output, gl_FragColor. So in testing:
vec4 color = texture2D(tex0, uv); gl_FragColor = color;
and still came up with artifacts is odd. I had spoken to Fen (go check them out btw they're awesome) and I recall something about v_tex_coord needing to be set to a_tex_coord in the Vertex shader-- I might be misremembering the details but if you're still getting those weird artifacts on your outputs when setting the input to the output (almost) directly, then we can really only assume that either the source texture or the coordinates are the problem.
I don't have it right in front of me at the moment, but if you're still toying with it and are familiar with it, it might be worth adding
v_tex_coord = a_tex_coord;
into the vertex shader and trying again. I'm about 80% sure I'm using v_tex_coord as UV, which feels like the most likely culprit.
If you're able to try and confirm it, I can add a correction into the pack pretty quick to prevent anyone else from running into the problem. Otherwise I'll see if I can reproduce and fix it when I have time. I'm currently drowning in VN dev, several new packs, Spooktober Jam scouting and prep, and a half dozen IRL things so I don't know when exactly I'll get to it.