The code which is used to get the texture height was accidentally using the width due to a cut-and-paste fail.