Can't get shader (border) to scale right

I’m making screenshots of Super Game Boy borders to use them with RetroArch. This works very well by using the /shaders/shaders_cg/borders/sgb/sgb.cgp (and .png) as a template and some Photoshop. However for a few games there’s no SGB border at all. A famous example is Super Mario Land 2 - 6 Golden Coins.

Now there’s Goomba Color and it has some custom borders included. Along those borders there’s a fine SML2 border:

91 Mario

I used Photoshop to make the inner field transparent/alpha as it has to be for RetroArch. In case anyone needs it:

Super Mario Land 2 6 Golden Coins

What Goomba does is, it converts GB/GBC roms into GBA roms. Because GBA has a higher resolution than GB, there’s some space around it which can be used by Goomba to patch one of those borders right into it. Unfortunately that means that the Goomba borders (including the Mario one) are in GBA resolution and not SNES/SGB resolution.

I tried around and edited some files but with no luck. As you can see, the picture is always scaled wrong:

SML2

Here’s my Super Mario Land 2 6 Golden Coins.cgp:

shaders = "1"
shader0 = "../resources/imgborder-goomba.cg"

scale_type_x0 = "absolute"
scale_x0 = "240"
scale_type_y0 = "absolute"
scale_y0 = "160"

parameters = "box_scale;in_res_x;in_res_y"
box_scale = "1.000000"
in_res_x = "160.000000"
in_res_y = "144.000000"

textures = "bg"
bg = "Super Mario Land 2 6 Golden Coins.png"

And here’s my …/resources/imgborder-goomba.cg:

#pragma parameter box_scale "Box Scale" 1.0 1.0 10.0 1.0
#pragma parameter location "Location" 0.5 0.2 1.0 0.001
#pragma parameter in_res_x "Horiz. Input Res" 160 160 600 1.0
#pragma parameter in_res_y "Vert. Input Res" 144 144 480 1.0
#pragma parameter out_res_x "Horiz. Output Res" 240.0 240.0 3840.0 40.0
#pragma parameter out_res_y "Vert. Output Res" 160.0 160.0 2160.0 40.0
#pragma parameter border_on_top "Border On Top" 1.0 0.0 1.0 1.0
#pragma parameter opacity "Border Opacity" 100.0 0.0 100.0 1.0
#ifdef PARAMETER_UNIFORM
uniform float box_scale;
uniform float location;
uniform float out_res_x;
uniform float out_res_y;
uniform float in_res_x;
uniform float in_res_y;
uniform float border_on_top;
uniform float opacity;
#else
#define box_scale 4.0
#define location 0.5
#define out_res_x 1920.0
#define out_res_y 1080.0
#define in_res_x 320
#define in_res_y 240
#define border_on_top 1.0
#define opacity 100.0
#endif
// END PARAMETERS //
#include "imgborder.inc"

What am I doing wrong?