Fractal shader not working

Hi, I’m trying to implement this shader in Monogame http://blog.nostatic.org/2009/09/fractal-rendering-on-gpu-mandelbrot-and.html but all I’m getting is a black screen.
Here’s are the relevant code pieces:

_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, effect);
_spriteBatch.Draw(screenTexture, Vector2.Zero, Color.White);
_spriteBatch.End();

screenTexture is just an orange texture that takes up the whole window.

and the effects file:

#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif

Texture2D SpriteTexture;

sampler2D SpriteTextureSampler = sampler_state
{
    Texture = (SpriteTexture);
    // AddressU = CLAMP;
    // AddressV = CLAMP;
    // MagFilter = LINEAR;
    // MinFilter = LINEAR;
    // Mipfilter = LINEAR;
};

struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
    float2 TextureCoordinates : TEXCOORD0;
};

int Iterations = 128;
float2 Pan = float2(0.5, 0);
float Zoom = 3;
float Aspect = 0.5f;
float2 JuliaSeed = float2(0.39, -0.2);
float3 ColorScale = float3(4, 5, 6);

float ComputeValue(float2 v, float2 offset)
{
    float vxsquare = 0;
    float vysquare = 0;

    int iteration = 0;
    int lastIteration = Iterations;

    do
    {
        vxsquare = v.x * v.x;
        vysquare = v.y * v.y;

        v = float2(vxsquare - vysquare, v.x * v.y * 2) + offset;

        iteration++;

        if ((lastIteration == Iterations) && (vxsquare + vysquare) > 4.0)
        {
            lastIteration = iteration + 1;
        }
    } while (iteration < lastIteration);
    return (float(iteration) - (log(log(sqrt(vxsquare + vysquare))) / log(2.0))) / float(Iterations);
}

float4 Mandelbrot_PixelShader(float2 texCoord : TEXCOORD0) : COLOR0
{
    float2 v = (texCoord - 0.5) * Zoom * float2(1, Aspect) - Pan;
    float val = ComputeValue(v, v);
    return float4(sin(val * ColorScale.x ), sin(val * ColorScale.y), sin(val * ColorScale.z), 1);
}

technique SpriteDrawing
{
    pass P0
    {
        PixelShader = compile PS_SHADERMODEL Mandelbrot_PixelShader();
    }
};

I’m new to HLSL and shaders in general so maybe there’s a small error somewhere?

edit: I was able to fix this using this tutorial instead https://digitalerr0r.net/2010/12/13/fundamentals-of-fractals-5-the-mandelbrot-set/

struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
    float2 TextureCoordinates : TEXCOORD0;
};

The above is unused and is only needed if you actually are using a vertex shader.
In that case this would be the input to the pixel shader.

Since there is none im surmising from shown code you are using this pixel shader with sprite batch or intend too. In that case the input to the (your) pixel shader that you sent to spriteBatch.Begin(…) must match BasicEffects VertexShader output. Like so…

//float4 PsSpriteBatch(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
//{
//    float4 col = tex2D(TextureSampler, texCoord) * color;
//    return col;
//}

//technique SpriteBatchPixelShader
//{
//    pass P0
//    {
//        PixelShader = compile PS_SHADERMODEL
//        PsSpriteBatch();
//    }
//}

also…

_spriteBatch.Draw(screenTexture, Vector2.Zero, Color.White);

The texture sampler you use in your shader needs to be assigned specifically to registers and textures that match what and were spritebatch is recieving the texture itself.

    //Texture2D Texture : register(t0);
    //sampler TextureSampler : register(s0)
    //{
    //    Texture = (Texture);
    //};

if you are going to use your own…

Texture2D SpriteTexture;

sampler2D SpriteTextureSampler = sampler_state
{
    Texture = (SpriteTexture);
    // AddressU = CLAMP;
    // AddressV = CLAMP;
    // MagFilter = LINEAR;
    // MinFilter = LINEAR;
    // Mipfilter = LINEAR;
};

Then that has to be additionally set from Game1 by setting it to your effect.
That is accomplished as follows.

effect.Parameters[“SpriteTexture”].SetValue( YourContentLoadedTextureHere );

Just prior or after begin should be fine to your previously shown Game1 draw code.

_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, effect);
_spriteBatch.Draw(screenTexture, Vector2.Zero, Color.White);
_spriteBatch.End();

That is a somewhat ambitious starting shader.

I would also suggest using SpriteSortMode.Immediate mode for now till you get more experience.