The game slows down because you are loading memory by creating the same sprites over and over and they never go away.
Assuming you stick with your basic methodology, you need to store the sprite ids when you create them.
Since you appear to be using an array of structures, add a field in your structure to store the sprite id. Make sure that the field is initialized to zero.
Then replace lines like this:
SetSpritePosition( CreateSprite(BorderPNG), sfx , sfy)
With something like this:
// check to see if there is a sprite
if (sf[x,y].spr_id <> 0) AND (GetSpriteExists(sf[x,y].spr_id) = 1)
// delete it
DeleteSprite(sf[x,y].spr_id)
endif
// now create the sprite
sf[x,y].spr_id = CreateSprite(BorderPNG)
// now set its position
SetSpritePosition(sf[x,y].spr_id,sfx,sfy)
Of course, you can create a function that does all those steps (using the same global array) by passing the x, y, sfx and sfy values and the image number to use for creating the sprite.
There are a lots of threads about dealing with gridded displays and best methods for handling refreshes and movement. I don't do that in my stuff (yet), so have only offered a fix for the problem you are seeing.
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master