Four points are enough, if chosen correctly.
In particular, I claim that the only square which passes through the four points $A(0,0)$, $B(0,0.3)$, $C(0.4,0)$, and $D(1,1)$ is the unit square with corners $(0,0), (0,1), (1,0), (1,1)$. The solution lets you find many more similar examples.
To prove this claim, here are some inequalities about the distances between points on a square with side length $s$:
- Two points on the same side are at a distance between $0$ and $s$;
- Two points on adjacent sides are at a distance between $0$ and $\sqrt2 s$;
- Two points on opposite sides are at a distance between $s$ and $\sqrt 2 s$.
We can check that if $A,B,C,D$ lie on a square, then they can't all lie on two adjacent sides of the square: there's no two lines that contain all four points and intersect at right angles. (It's enough to check that $AB$ is not perpendicular to $CD$, $AC$ is not perpendicular to $BD$, and $AD$ is not perpendicular to $BC$.) So there must be some pair of points on opposite sides.
The six distances between the points are $AB=0.3$, $AC=0.4$, $BC=0.5$, $CD \approx 1.16$, $BD \approx 1.22$, and $AD \approx 1.41$. So we see that if any two of $A,B,C$ were on opposite sides, the side length $s$ would be at most $0.5$, but $D$ is more than $0.5 \sqrt2 \approx 0.71$ away from all the rest. Therefore $A,B,C$ are all on two adjacent sides of the squares.
In particular, one side of the square must contain two of $A,B,C$. Can a side of the square contain $B$ and $C$? No: line $BC$ separates $A$ from $D$, which a side of the square can't do. If we assume $A,B$ are on one side of the square and $C$ is on an adjacent side, or that $A,C$ are on one side of the square and $B$ is on an adjacent side, we get the same conclusion: the square has a corner at $A$ with one side containing segment $AB$ and one side containing segment $AC$.
Since $D$ does not lie on either line, it must be on one of the other sides of the square: a side parallel to $AB$, and a side parallel to $AC$. We get the same square and try both.
- If we draw line $AB$, line $AC$, and a line through $D$ parallel to $AB$, those lines must contain three sides of the square. The only such square is the unit square.
- If we draw line $AB$, line $AC$, and a line through $D$ parallel to $AC$, those lines must contain three sides of the square. The only such square is the unit square.
Three points are never enough.
Take three points $A,B,C$. If they form a right triangle, we can draw ever-bigger squares with that right angle as a corner, containing all three. If they form an obtuse triangle, that's even better; suppose without loss of generality that the altitude from $C$ lands on line $AB$ at a point $H$ outside segment $AB$. Then we can draw ever-bigger squares with one corner at $H$ containing all three points.
For an acute triangle, begin by rotating the points arbitrarily. Let $x_{\min}, x_{\max}, y_{\min}, y_{\max}$ be the lowest and highest $x$- and $y$-coordinates among the three points; exclude the finitely many orientations where there are ties. Draw the four lines $x = x_{\min}, x=x_{\max}, y = y_{\min}, y = y_{\max}$; each of them passes through one point and together they contain all three (otherwise we'd get an obtuse angle). One of the points lies on two of the lines.
Without loss of generality, $A$ lies on $x = x_{\max}$ and $y = y_{\max}$ and also $x_{\max} - x_{\min} \ge y_{\max} - y_{\min}$. Then erase the line through $y = y_{\max}$ and instead draw the line through $y = y_{\min} + x_{\max} - x_{\min}$. These four lines define a square containing all three points. Since we get this for all but finitely many ways to rotate $A,B,C$ (equivalently, for all but finitely many choices of a horizontal and vertical direction) we get infinitely many squares.