Physics undergraduate here :) I was wondering whether this is true:
The line-integral of the vector field $\vec{F}=(A,B)$ is zero for every rectangular closed path in $\mathbb{R}^2$ $\Rightarrow \vec{F}$ is conservative (it is zero around every path).
Does it actually hold?
Just in case, my "intuitition" below... :)
First, the line-integral of any smooth curve can be approximating with a "staircase" on the $(x,y)$ plane (hope it does not imply $\pi=4$): $$\int_\text{staircase} d\vec{s}\cdot\vec{F} \equiv \sum_i\left(\int_{x_i}^{x_{i+1}} A(x,y_i)dx + \int_{y_i}^{y_{i+1}} B(x_{i+1},y)dy\right)$$ $$= \sum_i\left(\int_{x_i}^{x_{i+1}} A(x,y_i)dx + \int_{y_i}^{y_{i+1}} \left[ B(x_{i},y) + O(\Delta x)\right]dy\right) $$ $$= \sum_i A(x_i,y_i)\Delta x + O(\Delta x^2) + \left[B(x_i,y_i)+O(\Delta x)\right]\Delta y + O(\Delta y^2)$$ Taking enough steps in the staircase $\Delta x \to 0 \Rightarrow \Delta y \to 0$: $$\sum_i A(x_i,y_i)\Delta x + B(x_i,y_i)\Delta y \rightarrow \int(Adx+Bdy) \equiv \int_\textrm{actual curve} d\vec{s}\cdot \vec{F}$$ And the summation over error terms vanishes: $$\sum_i O(\Delta x^2) +O(\Delta x)\Delta y + O(\Delta y^2) \sim \frac{1}{\Delta x}\times \Delta x\Delta x \to 0$$ This (hopefully) shows that the line-integral of a vector field can be approximated by a staircase. Equiped with this, we may proceed to "jusify" the claim by approximating the closed curve by many rectangular paths:
![]()
Given that the integration over every rectangle is zero by assumption and the "staircase" approximates the actual integral, the line-integral of the smooth curve is zero.

The answer to your question as stated (before the edit) is no, after the edit is yes (see below).
For an explicit counter example (to your question before the edit), consider the following vector field: $F: \Bbb{R}^2 \setminus\{0\} \to \Bbb{R}^2$ defined by \begin{align} F(x,y) = \left( \dfrac{-y}{x^2 + y^2}, \dfrac{x}{x^2 + y^2}\right) \end{align} Then, a simple direct calculation shows that if $\gamma(t) = (\cos t, \sin t)$, where $0\leq t \leq 2\pi$, then \begin{align} \int_{\gamma} F \cdot dl &= 2\pi \end{align} However, you can check that the curl of this vector field is $0$ identically on all of $\Bbb{R}^2\setminus\{0\}$, so that by Green's/Stokes' theorem (whatever you wish to call it), if $\gamma$ is the boundary of a rectangular path (the entire rectangle, both the interior and boundary being contained inside $\Bbb{R}^2\setminus\{0\}$) we have that $\int_{\gamma}F \cdot dl = 0$.
Anyway, if you know a bit about differential forms, then here's how we can describe the situation. Let $U \subset \Bbb{R}^2$ be an open set, and $\omega = P \, dx + Q \, dy$ be a $C^1$, differential $1$-form defined on $U$. Then, the following statements are equivalent:
Another notion is that of exactness. For that, we have the following two equivalent statements:
$\omega$ is an exact differential form on $U$; i.e there exists a $C^2$ function $f: U \to \Bbb{R}$ such that $\omega = df$. i.e such that $P = \dfrac{\partial f}{\partial x}$ and $Q = \dfrac{\partial f}{\partial y}$.
For every piecewise differentiable closed curve $\gamma$ in $U$, we have $\int_{\gamma} \omega = 0$ (not just for rectangular ones).
Note that checking whether a differential form is closed or not is very simply; just calculate two partial derivatives and see if they're equal. Checking for exactness is a much more difficult task. However, one helpful theorem is the following:
So for example, if you take $U = \Bbb{R}^2$, then by the above theorem, yes, the integral vanishing over closed rectangular curves implies the integral vanishes over arbitrary (piecewise-differentiable) closed curves. For a reference regarding proofs of these claims, I suggest taking a look at Henri Cartan's textbook on Complex Analysis.