Projected Texture Shader Issues

So I’ve written a shader that allows me to project a texture onto a model

Shader "Custom/FlatStaticTexture" {
	Properties {
		_Texture("Texture", 2D) = "white" {}
	}
	SubShader {
		Pass {			
			CGPROGRAM				
				#pragma fragment frag
				#pragma vertex vert
				#include "UnityCG.cginc"
				
				float4 _Color;
				sampler2D _Texture;
				
				struct v2f {
					float4 pos : SV_POSITION;
					float4 ref : TEXCOORD0;
				};
				
				float4 _Texture_ST;
				
				v2f vert(appdata_base v) {
					v2f o;
					o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
					o.ref = ComputeScreenPos(o.pos);
					return o;
				}
				
				fixed4 frag(v2f i) : SV_Target {
					fixed4 texcol = tex2Dproj(_Texture, i.ref);
					return texcol;
				}
			ENDCG
		}
	} 
}

the only issue is that it is distorted because it’s stretching it across the entire screen. Would there be any way to tile the image based on screen width so that it doesn’t get distorted. The tile and offset parameters in the inspector do not do anything.

I think this works:

float2 coords = i.ref;
coords.x *= _ScreenParams.x / _ScreenParams.y;
fixed4 texcol = tex2Dproj(_Texture, coords);

“_ScreenParams” is a builtin variable, more infos can be found here: Unity - Manual: Built-in shader variables