Handle one pixel offset on the width/height
Move the sample code to the enesim coord

Add a repeat sample code so the out of bounds coords are repeated