Another cause of this might be that you're not using whole pixels. Ensure there's no decimal points in the size of your shape.