Add hpos/vpos counter logic.