Its because the sprite that is being drawn is not actually on the screen when you move the view offset that far over (its position is 0,0), so it gets culled by AGK. Culled = It never gets drawn since AppGameKit thinks you cant see it, so no point in drawing it.
AGK doesnt really know the sprite is getting repositioned by the shader
You can fix that by moving the sprite into the viewable area....something like this
SetErrorMode(2)
SetWindowTitle( "demo problem" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
LoadShader(1,"vertex.vs","pixel.ps")
loadimage(1,"blankwhite.png")
createsprite(1,1)
setspriteshader(1,1)
do
Setspriteposition(1,GetViewOffsetX(),GetViewOffsetY())
for k=0 to 10
x1=random(0,1000)-GetViewOffsetX()
y1=random(0,1000)-GetViewOffsetY()
x2=x1+50
y2=y1+50
SetShaderConstantArrayByName(1,"Coords",0,x1,y1,0,0) // Top left
SetShaderConstantArrayByName(1,"Coords",1,x1,y2,0,0) // bottom left
SetShaderConstantArrayByName(1,"Coords",2,x2,y1,0,0) // Top right
SetShaderConstantArrayByName(1,"Coords",3,x2,y2,0,0) // bottom right
drawsprite (1)
next k
if GetRawMouseLeftState()
SetViewOffset(getviewoffsetx()+1,0)
endif
print ("left mouse button to move viewport")
print(GetViewOffsetX())
sync()
loop
.....or just make the sprite very very huge
SetSpriteSize(1,5000,5000) <- this will still be seen until you go over to view offset of about 5155). This wont change the size of the sprite at all....It will still be drawn at the right size.
.....or, make the sprite a 3d object and turn off object screen space culling for it.
EDIT:
Lastly, the coordinates you were using for the corners was incorrect (hence why a triangle was being drawn instead of a quad. I fixed that in the example above.