Fix rect positioning when loading from JSON. Closes #522