Terraria item ID 2799. Terraria 1.4.5.7.
The Mechanical Ruler is an informational accessory that, when equipped, draws a cyan, semi-transparent grid overlay on the screen, making individual block distances much clearer. This grid fades out when the player begins moving and returns once movement stops. The row and column of the block the mouse is hovering over are also highlighted in red, drawing a cross on the screen with the cursor at its center. The Mechanical Ruler can be purchased from the Mechanic for 1 Gold.
Description from the Terraria Wiki.