Fix for #1241 - more than 16383 batch items

Supports more than 16383 batch items. Tested with 75000 batch items and with two different textures in the same batch operation. Also refactored the duplicate index initialization code to make it one method used by the ctor and the batch drawing code.

#1241 and #1520 are included in this commit.