Aha, I see what you're doing. You've basically made a bounding box that's bigger than the object (player in my case) by 4 pixels all around and you're looping through all of the box's edge pixels ( or is it 4 tiles all around the object instead? ) to check for intersection with a collide-able tile.
its 4 tiles around. You can also use this method to render, then you will see what tiles are checked for collision, as only those are rendered on screen. or rendering all, but overlaying those with a color or something
Do you mind if I ask you how you resolve your collisions, specifically what you do with you player to prevent them from passing through the collide-able object?
This is a really broad topic, and I can't say that after long time of development I got it right. It obviously has a lot to do with what constraints you have.
gravity, shaped and nature of objects, what can the player do
specifically diagonal tiles, going up and down can be a nightmare if your player can do much to break it.
But basically my sprites have a x and y speed
I will create another Rectangle(reuse this object) copy the values of the player or whatever sprite we are talking about.
then I do x+=speedX and y+=speedY obviously
and then I take this changed Rectangle and ask if there is a collision with it.
If yes I wont apply that speed for the sprite, if no, I do.
there are always little problems and stuff thats 1 pixel off and so on and so forth, hard to get perfect depending on how complex the game is.
I mean even in super mario you can jump into the wall if you know how
clipping and collision issues are found in most commercial games even today
hard to get right