This is happening because the Instantiate function will spawn the prefab relative to world space and set its position before you assign it as a child. So when you assign it as a child, all that happens is transform.localPosition is changed relative to the parent. What you would want to do is something like this:
var piece = (GameObject) Object.Instantiate(PiecePrefab);
piece.transform.parent = transform;
piece.transform.localPosition = new Vector3(j*boxSize,i*boxSize,0);
This will spawn the object. Set it as a child of the object running the script. Then set its position, relative to its parent.