Probably involved in the osmoprotection via the biosynthesis of trehalose and in the production of glycogen and alpha-glucan via the TreS-Pep2 branch involved in the biosynthesis of maltose-1-phosphate (M1P). Catalyzes the transfer of glucose from UDP-glucose (UDP-Glc) to D-glucose 6-phosphate (Glc-6-P) to form trehalose-6-phosphate. Probably also able to use ADP-Glc, CDP-Glc, GDP-Glc and TDP-Glc as glucosyl donors. ADP-alpha-D-glucose + D-glucose 6-phosphate = ADP + alpha,alpha-trehalose 6-phosphate + H(+) CDP-alpha-D-glucose + D-glucose 6-phosphate = alpha,alpha-trehalose 6-phosphate + CDP + H(+) D-glucose 6-phosphate + GDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + GDP + H(+) D-glucose 6-phosphate + TDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + TDP D-glucose 6-phosphate + UDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + UDP Glycan biosynthesis; trehalose biosynthesis. Homotetramer. Belongs to the glycosyltransferase 20 family.