And two screenshots to illustrate the difference of changing document page sizes in InDesign CS6 (and above):
1. "Wrong" or "dangerous" approach with the Document Setup GUI:

2. "Appropriate" approach with the Pages Tool:

"Wrong", "dangerous" and "appropriate" in the sense, that scripting will work as expected without moving overridden page items to their original positions.
To correct the problematic example #1, just use the Document Setup GUI and go back to the original size and change size again by using the Page Tool.
Uwe
Uwe, Trevor, tomas8,
Thanks to Uwe's investigations/tests I finally came up with a scripted solution that sounds clean to me—but it still needs to be tested in CS5/5.5.
My main finding is that the matrix Page.masterPageTransform (property available in CS5 and later) accurately reflects the shift we are trying to circumvent.
When a new page is created in the 'corrupted' document based on any master spread, CS6 and CC show the following result:
alert( myNewPage.masterPageTransform.matrixValues );
// => 1,0,0,1,-150,-150 Here it is!
As far as I understand this matrix determines the transformation "applied to the master page before it is applied to Page," that is, how the page is mapped to its master page. In normal case that should be—I suppose—the IDENTITY matrix.
My guess is that CS6/CC improperly uses those matrix values during scripted overrides, so that we have to explicitly apply the inverse matrix to the newly created page, as follows:
var document = app.activeDocument;
var csvData = {
"master" : ["A-Master", "B-Master", "C-Master"],
"numberOfRows" : 3
};
loadPagesAndOverrideElements(document, csvData);
function loadPagesAndOverrideElements(document, csvData)
{
// Constants
// ---
const CS_INNER = +CoordinateSpaces.innerCoordinates,
ORIGIN = [[0,0],CS_INNER];
// Variables
// ---
var i, n = csvData.numberOfRows,
ms, pg, mx;
// Unlock ALL layers
// ---
document.layers.everyItem().locked = false;
// Page creation loop
// ---
for( i=0 ; i < n ; ++i )
{
// Select the master spread
// ---
ms = document.masterSpreads.itemByName(csvData["master"]);
// Create new page and override master items
// ---
ms.pageItems.everyItem().override( pg=document.pages.add({appliedMaster:ms}) );
// Revert the masterPageTransform if needed
// ---
(mx=pg.properties.masterPageTransform) && pg.transform(CS_INNER, ORIGIN, mx.invertMatrix());
}
// Remove the 1st page
// ---
document.pages[0].remove();
};
Seems to work for me.
What about CS5?
@+
Marc