"At the top" is: うえに so if you wanted to say at the top of X you'd write Xのうえに. Same goes for "at the bottom" which is したに.
ひだりに means "on the left" みぎに means "on the right".
"In the foreground" is: ぜんぽうにあります. If you wanted to say "the x in the foreground" you would say ”ぜんぽうにあるX”.
"Background" is a little difficult because there are different words you can use depending on context see:
http://tinyurl.com/b34oj7
みぎうえすみ means "in the top right hand corner". ひだりうえすみ means "in the top left hand corner". You can use した in place of うえ in these sentences to mean "in the bottom left/right hand corner".