Square-wave amperometry with iR-drop compensation