This should work as long as you don't rotate the z axis. I made it for camera use originally so there was no z axis rotation. I'll fix for you though.
//1----2
//| |
//3----4
Function PlainCornerXPosition( Corner as Integer , ObjNum as Integer )
If Corner = 1 then XPos# = Object Position X( ObjNum ) + ThreeDimensionalRotationMatrixX( ( Object Size X( ObjNum ) / 2 ) * -1 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 2 then XPos# = Object Position X( ObjNum ) + ThreeDimensionalRotationMatrixX( Object Size X( ObjNum ) / 2 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 3 then XPos# = Object Position X( ObjNum ) + ThreeDimensionalRotationMatrixX( ( Object Size X( ObjNum ) / 2 ) * -1 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 4 then XPos# = Object Position X( ObjNum ) + ThreeDimensionalRotationMatrixX( Object Size X( ObjNum ) / 2 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
EndFunction XPos#
Function PlainCornerYPosition( Corner as Integer , ObjNum as Integer )
If Corner = 1 then YPos# = Object Position Y( ObjNum ) + ThreeDimensionalRotationMatrixY( ( Object Size X( ObjNum ) / 2 ) * -1 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 2 then YPos# = Object Position Y( ObjNum ) + ThreeDimensionalRotationMatrixY( Object Size X( ObjNum ) / 2 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 3 then YPos# = Object Position Y( ObjNum ) + ThreeDimensionalRotationMatrixY( ( Object Size X( ObjNum ) / 2 ) * -1 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 4 then YPos# = Object Position Y( ObjNum ) + ThreeDimensionalRotationMatrixY( Object Size X( ObjNum ) / 2 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
EndFunction YPos#
Function PlainCornerZPosition( Corner as Integer , ObjNum as Integer )
If Corner = 1 then ZPos# = Object Position Z( ObjNum ) + ThreeDimensionalRotationMatrixZ( ( Object Size X( ObjNum ) / 2 ) * -1 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 2 then ZPos# = Object Position Z( ObjNum ) + ThreeDimensionalRotationMatrixZ( Object Size X( ObjNum ) / 2 , Object Size Y( ObjNum ) / 2 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 3 then ZPos# = Object Position Z( ObjNum ) + ThreeDimensionalRotationMatrixZ( ( Object Size X( ObjNum ) / 2 ) * -1 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
If Corner = 4 then ZPos# = Object Position Z( ObjNum ) + ThreeDimensionalRotationMatrixZ( Object Size X( ObjNum ) / 2 , ( Object Size Y( ObjNum ) / 2 ) * -1 , 0 , Object Angle X( ObjNum ) , Object Angle Y( ObjNum ) )
EndFunction ZPos#
Function ThreeDimensionalRotationMatrixX(XPos as Float ,YPos as Float ,ZPos as Float ,AngX as Float ,AngY as Float )
ZPos=(YPos*Sin(AngX))+(ZPos*Cos(AngX))
XPos=(XPos*Cos(AngY))+(ZPos*Sin(AngY))
EndFunction XPos
Function ThreeDimensionalRotationMatrixY(XPos as Float ,YPos as Float ,ZPos as Float ,AngX as Float ,AngY as Float )
YPos=(YPos*Cos(AngX))+(ZPos*(-1*Sin(AngX)))
EndFunction YPos
Function ThreeDimensionalRotationMatrixZ(XPos as Float ,YPos as Float ,ZPos as Float ,AngX as Float ,AngY as Float )
ZPos=(YPos*Sin(AngX))+(ZPos*Cos(AngX))
ZPos=(XPos*(-1*Sin(AngY)))+(ZPos*Cos(AngY))
EndFunction ZPos