Lattice points in a square pairwise-separated by integer distances Let $S_n$ be an $n \times n$ square of lattice points in $\mathbb{Z}^2$.

Q1. What is the largest subset $A(n)$ of lattice points in $S_n$ that have the
  property that every pair of points in $A(n)$ are separated by
  an integer Euclidean distance?

Is it simply that $|A(n)| = n$?
And similarly in $\mathbb{Z}^d$ for $d>2$?

          


          

$5 \times 5$ lattice square, $5$ collinear points.



Q2. What is the largest subset $B(n)$ of lattice points in $S_n$,
  not all collinear, that have the
  property that every pair of points in $B(n)$ are separated by
  an integer Euclidean distance?


          


          

$5 \times 5$ lattice square, $4$ noncollinear points.


A $9 \times 9$ example with $5$ noncollinear points,
also based on $3{-}4{-}5$ right triangles, 
is illustrated in the Wikipedia article
Erdős–Diophantine graph.

Here are @AnthonyQuas's four points $\{o,p_1,p_2,p_3\}$ in 
$S(2) \subset \mathbb{Z}^{25}$:
$$
\begin{array}{cccccccccccccccc
   ccccccccc}
 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 0 & 0 \\
 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 0 & 0 \\
 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0
   & 0 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 1 & 1 \\
 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 1 & 1 & 1 & 1 & 1 & 1
   & 1 & 1 & 1 \\
\end{array}
$$
You can see that $p_1$ has nine $1$'s in its coordinate representation, 
$p_2$ has sixteen $1$'s,
and $p_3$ has twenty-five $1$'s:
$3{-}4{-}5$ triangles again—very clever!
