float selectedDesqueezeFactor()
{
    if (desqueezeFactor == 0)
        return 1.3;
    if (desqueezeFactor == 1)
        return 1.3333333;
    if (desqueezeFactor == 2)
        return 1.5;
    return 2.0;
}

float4 shadeVideo(ShaderContext context)
{
    float factor = selectedDesqueezeFactor();
    float2 centered = context.uv - 0.5;

    if (framing == 0)
    {
        centered.y *= factor;
    }
    else
    {
        centered.x /= factor;
    }

    float2 sourceUv = centered + 0.5 - pan;
    bool inside = sourceUv.x >= 0.0 && sourceUv.x <= 1.0 && sourceUv.y >= 0.0 && sourceUv.y <= 1.0;
    if (!inside)
        return outsideColor;

    return sampleVideo(sourceUv);
}
