Wolfram Language (Mathematica), 263284 bytes, score ~150000 on TIO
Fixed a bug thanks to @att.
With[{size = 2 Ceiling[Sqrt@#/2.7] + 3},
PrintWriteString[$Output, ##] & @@
FixedPoint[
BitAnd[#, 3] +
With[{q = BitShiftRight[#, 2]},
Sum[RotateLeft[q, d], {d, {1, -1, size, -size}}]] &,
CenterArray[#, size^2]]] &@ToExpression[$ScriptCommandLine[[2]]]