Only a guess, but you might try initializing V1..V6, R1,R2 and FX1,FY1 to some value VERY early in the program before other internal (invisible to you) temporary variables are created.
Using a variable, before declaring it, in most languages can do strange things, as the variables have random values or just don't exist.